package com.erps.dao;

import com.erps.CommonUtils.ActiveField;
import com.erps.CommonUtils.DateUtils;
import com.erps.CommonUtils.JActiveField;
import com.erps.CommonUtils.JActiveTable;
import com.erps.CommonUtils.Sequence;
import com.erps.db.DBManager;
import com.hmkj.entity.ErspResPicture;
import com.hmkj.entity.ErspSysRole;

public class ErspSysRoleDao extends JActiveTable{
	public ErspSysRoleDao() {
		this.setDBTableName("ersp_sys_role");
		AddField(new JActiveField("id", "id", ActiveField.ftString, 36));
		setDefaultFieldValue("id", Sequence.getGuid());
		AddField(new JActiveField("role_name", "role_name", ActiveField.ftString, 20));
		AddField(new JActiveField("role_desc", "role_desc", ActiveField.ftString, 200));
		
		
		
		AddField(new JActiveField("last_update_time", "last_update_time", ActiveField.ftLong));
		setDefaultFieldValue("last_update_time", String.valueOf(DateUtils.getDayTimeNum()));
        setDbKeyFields("id");
	}

	public int add(ErspSysRole vo) {
		setFieldValue("id", vo.getId());
		setFieldValue("role_name", vo.getRole_name());
		setFieldValue("role_desc", vo.getRole_desc());
		
		return DBManager.ExecSQL(this.getSQL());
	}

	public String getSQL(ErspSysRole vo) {
		setFieldValue("id", vo.getId());
		setFieldValue("role_name", vo.getRole_name());
		setFieldValue("role_desc", vo.getRole_desc());
		return this.getSQL();
	}
}
